<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script src="http://lib.sinaapp.com/js/jquery/1.7.2/jquery.min.js"
	type="text/javascript"></script>
<script type="text/javascript">
	var socket = null;
	$(function() {
		//创建socket对象
		//把下面的IP改成服务器IP，把customer_id改成对应的值
		//var url = "ws://127.0.0.1:21500/rollNoticeSocket/29";
		var url = "ws://127.0.0.1:21500/sysNoticeSocket/31";
		socket = new WebSocket(url);
		//连接创建后调用
		socket.onopen = function() {
			$("#showMsg").append("连接成功...<br/>");
		};
		//接收到服务器消息后调用
		socket.onmessage = function(message) {
			$("#showMsg").append("<span style='display:block'>"+message.data+"</span>");
			$("#showMsg").append("<br/>");
		};
		//关闭连接的时候调用
		socket.onclose = function() {
			$("#showMsg").append("关闭连接<br/>");
		};
		//出错时调用
		socket.onerror = function() {
			$("#showMsg").append("连接出错<br/>");
		};
	});
</script>
</head>
<body>
	<div id="showMsg"
		style="border: 1px solid; width: 500px; height: 400px; overflow: auto;"></div>
</body>
</html>
